/**
 * Created by zhengguorong on 2016/11/30.
 */
import * as http from '../util/http'
// import httpRequest from '@/utils/httpRequest'
const getUserThemeList = (type = 'h5') => {
  // return http.get('/api/pages?type=' + type)
}
const getPageByThemeId = (id) => {
  return http.get('/sys/theme/info/' + id)
}
const getPageBySkinId = (id) => {
  return http.get('/sys/skin/info/' + id)
}

const saveTheme = (theme) => {
  return http.post('/sys/theme/save', theme)
}
const saveSkin = (theme) => {
  return http.post('/sys/skin/save', theme)
}
const delTheme = (theme) => {
  // return http.del('/api/pages', theme)
}
const updateTheme = (theme) => {
  return http.put('/sys/theme/update', theme)
}

const updateSkin = (theme) => {
  return http.put('/sys/skin/update', theme)
}

const uploadPic = (data) => {
  console.log('uploadPic():data', data)
  return http.post('/sys/upload?iconPath=material&type=2', data)
}

const getPicListByThemeId = (data) => {
  // return http.get(`/api/upload/theme/${_id}?fileType=image`)
}

const getVideoListByThemeId = (_id) => {
  // return http.get(`/api/upload/theme/${_id}?fileType=video`)
}

const api = {
  getUserThemeList, saveTheme, updateTheme, uploadPic, getPageByThemeId, getPicListByThemeId, delTheme, getVideoListByThemeId, getPageBySkinId, saveSkin, updateSkin

}

export default api
